package com.banshuibao.bsb_android.adapter;

import android.content.Context;
import android.widget.TextView;

import com.banshuibao.bsb_android.R;
import com.banshuibao.bsb_android.model.KnowledgeModel;
import com.banshuibao.bsb_android.util.TimeUtil;

import java.util.List;

/**
 * Created by Administrator on 2017/12/20.
 */

public class KnowledgeCaseAdapter extends MineBaseAdapter<KnowledgeModel.DataBean> {

    public KnowledgeCaseAdapter(Context context, List<KnowledgeModel.DataBean> data, int layoutResId) {
        super(context, data, layoutResId);
    }

    @Override
    protected void bindData(ViewHolder holder, KnowledgeModel.DataBean item) {
        TextView content = (TextView) holder.getView(R.id.case_content);
        TextView look = (TextView) holder.getView(R.id.case_look);
        TextView date = (TextView) holder.getView(R.id.case_date);
        String time = null;
        if (item.getCreateDate() != 0) {
            time = TimeUtil.format(item.getCreateDate());
        } else {
            time = "";
        }
        date.setText(time);
        content.setText(item.getTitle());
        look.setText(String.valueOf(item.getClickNum()));
    }
}
